package com.nidu.demo.notice;

import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.nidu.demo.common.enums.StatusEnum;
import com.nidu.demo.notice.api.SysNoticeService;
import com.nidu.demo.notice.dto.*;
import com.nidu.demo.notice.executor.command.*;
import com.nidu.demo.notice.executor.query.*;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Set;

/**
 * 通知公告服务实现类
 *
 * @author auto
 */
@Service
@RequiredArgsConstructor
public class SysNoticeServiceImpl implements SysNoticeService {

    private final NoticeAddCmdExe addCmdExe;
    private final NoticeUpdateCmdExe updateCmdExe;
    private final NoticeDeleteCmdExe deleteCmdExe;
    private final NoticeSingleQryExe singleQryExe;
    private final NoticeListQryExe listQryExe;
    private final NoticePageQryExe pageQryExe;

    @Override
    public SingleResponse<NoticeCO> add(NoticeAddCmd cmd) {
        return addCmdExe.execute(cmd);
    }

    @Override
    public SingleResponse<NoticeCO> update(NoticeUpdateCmd cmd) {
        return updateCmdExe.execute(cmd);
    }

    @Override
    public Response delete(Long id) {
        return deleteCmdExe.execute(id);
    }

    @Override
    public Response delete(Set<Long> ids) {
        return deleteCmdExe.execute(ids);
    }

    @Override
    public SingleResponse<NoticeCO> getById(Long id) {
        return singleQryExe.execute(id);
    }

    @Override
    public MultiResponse<NoticeCO> list(NoticeListQry qry) {
        return listQryExe.execute(qry);
    }

    @Override
    public PageResponse<NoticeCO> page(NoticePageQry qry) {
        return pageQryExe.execute(qry);
    }

    @Override
    public Response updateStatus(Long id, StatusEnum status) {
        return updateCmdExe.updateStatus(id, status);
    }

}
